home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue37 / DynArr / Array6U.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-07-03  |  1.2 KB  |  56 lines

  1. unit Array6U;
  2.  
  3. interface
  4.  
  5. uses
  6.   WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls,
  7.   Forms, Dialogs, Grids, StdCtrls, Array6U2, ExtCtrls, Spin;
  8.  
  9. type
  10.   TArray6MainForm = class(TForm)
  11.     lstArrayContents: TListBox;
  12.     Panel1: TPanel;
  13.     edtElement: TEdit;
  14.     btnGetValue: TButton;
  15.     btnSetValue: TButton;
  16.     edtValue: TSpinEdit;
  17.     Label1: TLabel;
  18.     Label2: TLabel;
  19.     procedure FormCreate(Sender: TObject);
  20.     procedure FormDestroy(Sender: TObject);
  21.     procedure btnGetValueClick(Sender: TObject);
  22.     procedure btnSetValueClick(Sender: TObject);
  23.   private
  24.     MyArray: TIntegerArray;
  25.   end;
  26.  
  27. var
  28.   Array6MainForm: TArray6MainForm;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33.  
  34. procedure TArray6MainForm.FormCreate(Sender: TObject);
  35. begin
  36.   MyArray := TIntegerArray.Create;
  37. end;
  38.  
  39. procedure TArray6MainForm.FormDestroy(Sender: TObject);
  40. begin
  41.   MyArray.Free
  42. end;
  43.  
  44. procedure TArray6MainForm.btnGetValueClick(Sender: TObject);
  45. begin
  46.   edtValue.Value := MyArray[edtElement.Text]
  47. end;
  48.  
  49. procedure TArray6MainForm.btnSetValueClick(Sender: TObject);
  50. begin
  51.   MyArray[edtElement.Text] := edtValue.Value;
  52.   lstArrayContents.Items := MyArray.List
  53. end;
  54.  
  55. end.
  56.